package nc.tb.cube.fmldim;

import java.util.Comparator;

public class FmlDimComparator implements Comparator<IFmlDim> {

	public int compare(IFmlDim o1, IFmlDim o2) {
		if (o1 == null && o2 == null)
			return 0;
		if (o1 == null && o2 != null)
			return -1;
		if (o1 != null && o2 == null)
			return 1;
		if (o1.getGroup_id() == o2.getGroup_id())
			return o1.getIndex() - o2.getIndex();
		return o1.getGroup_id() - o2.getGroup_id();
	}

}
